home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 12 / Amiga Format AFCD12 (Apr 1997, Issue 96).iso / -in_the_mag- / html_tutorial / fstream.h < prev    next >
C/C++ Source or Header  |  1997-01-21  |  450b  |  27 lines

  1. // Faked fstream to use less memory
  2.  
  3.  
  4. class ofstream : public ostream {
  5. public:
  6.   ofstream(char name[], ios::Selector);
  7.   bool fail();
  8. protected:
  9. private:
  10.   FILE *the_stream;
  11. };
  12.  
  13. ofstream::ofstream( char name[], ios::Selector ) : 
  14.   ostream( the_stream = fopen( name, "a+" ) )
  15. {
  16. }
  17.  
  18. bool ofstream::fail()
  19. {
  20.   return (bool) (the_stream == NULL);
  21. }
  22.  
  23. class ifstream : public istream {
  24. public:
  25.   ifstream(char name, ios::Selector ) : istream(NULL) { }
  26. };
  27.